import {
    GETMOVIELIST
} from "../constant/movieConst"

//定义reducer初始值
const init = {
    movieList: []
}

//reducer是一个函数
export default function countReducer(prevState = init, action){
    //拿到 新数据
    const {
        type,
        data
    } = action

    //判断并确定处理逻辑
    switch (type) {
        case GETMOVIELIST:
         return {
            //不改变原值,直接覆盖
            ...prevState,
            movieList: data
         }

    }
    
    return prevState
}